#!/usr/bin/make -f

export DH_VERBOSE=1
export DH_OPTIONS=-v

# override_dh_auto_clean:
# 	rm -rf ./debian/figma-linux

override_dh_auto_install:
	mkdir -p ./debian/figma-linux/opt/figma-linux
	mkdir -p ./debian/figma-linux/usr/share/applications
	mkdir -p ./debian/figma-linux/usr/share/icons/hicolor
	rsync -av --progress ./* ./debian/figma-linux/opt/figma-linux/ --exclude debian --exclude .pc --exclude resources/icon --exclude resources/figma-linux.desktop
	cp -rf ./resources/figma-linux.desktop ./debian/figma-linux/usr/share/applications/
	chmod 755 ./debian/figma-linux/opt/figma-linux/figma-linux

	bash -c 'for file in ./resources/icon/*; do name=`basename $${file%.*}`; mkdir -p ./debian/figma-linux/usr/share/icons/hicolor/$${name}/apps; cp -rf "$$file" ./debian/figma-linux/usr/share/icons/hicolor/$${name}/apps/figma-linux.png; done'

	rm -rf ./resources/icon ./resources/figma-linux.desktop

	xdg-mime default figma-linux.desktop x-scheme-handler/figma


override_dh_shlibdeps:

override_dh_builddeb:
	dpkg-deb --build debian/figma-linux ..

%:
	dh $@


# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
#	dh_auto_configure -- #	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

